/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author ori
 */
@Entity
@Table(name = "TransportationType")
@NamedQueries({@NamedQuery(name = "TransportationType.findAll", query = "SELECT t FROM TransportationType t"), @NamedQuery(name = "TransportationType.findByTransportType", query = "SELECT t FROM TransportationType t WHERE t.transportType = :transportType"), @NamedQuery(name = "TransportationType.findBySpeedKms", query = "SELECT t FROM TransportationType t WHERE t.speedKms = :speedKms"), @NamedQuery(name = "TransportationType.findByCostPerKm", query = "SELECT t FROM TransportationType t WHERE t.costPerKm = :costPerKm")})
public class TransportationType implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "transportType")
    private String transportType;
    @Basic(optional = false)
    @Column(name = "speedKms")
    private double speedKms;
    @Basic(optional = false)
    @Column(name = "costPerKm")
    private double costPerKm;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "transportationType")
    private Collection<Transportation> transportationCollection;

    public TransportationType() {
    }

    public TransportationType(String transportType) {
        this.transportType = transportType;
    }

    public TransportationType(String transportType, double speedKms, double costPerKm) {
        this.transportType = transportType;
        this.speedKms = speedKms;
        this.costPerKm = costPerKm;
    }

    public String getTransportType() {
        return transportType;
    }

    public void setTransportType(String transportType) {
        this.transportType = transportType;
    }

    public double getSpeedKms() {
        return speedKms;
    }

    public void setSpeedKms(double speedKms) {
        this.speedKms = speedKms;
    }

    public double getCostPerKm() {
        return costPerKm;
    }

    public void setCostPerKm(double costPerKm) {
        this.costPerKm = costPerKm;
    }

    public Collection<Transportation> getTransportationCollection() {
        return transportationCollection;
    }

    public void setTransportationCollection(Collection<Transportation> transportationCollection) {
        this.transportationCollection = transportationCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (transportType != null ? transportType.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TransportationType)) {
            return false;
        }
        TransportationType other = (TransportationType) object;
        if ((this.transportType == null && other.transportType != null) || (this.transportType != null && !this.transportType.equals(other.transportType))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entity.TransportationType[transportType=" + transportType + "]";
    }

}
